package com.bistu.sim.xwy.news.Other;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.bistu.sim.xwy.news.R;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;

public class GoodsPageActivity extends AppCompatActivity {

    private String sold;
    private String content;
    private String image;
    private String name;
    private String price;
    private String type;


    private ImageView imageView;

    private TextView name_view;
    private TextView sold_view;
    private TextView content_view;
    private TextView type_view;
    private TextView price_view;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_goods_page);
        initview();
    }

    private void initview() {
        Intent intent = getIntent();
        if(intent != null){
           image = intent.getStringExtra("image");
           sold = intent.getStringExtra("sold");
           content = intent.getStringExtra("content");
           name = intent.getStringExtra("name");
           price = intent.getStringExtra("price");
           type = intent.getStringExtra("type");

        }
        imageView = (ImageView) findViewById(R.id.image);
        name_view = (TextView) findViewById(R.id.name);
        price_view = (TextView) findViewById(R.id.price);
        sold_view = (TextView) findViewById(R.id.sold);
        type_view = (TextView) findViewById(R.id.type);
        content_view = (TextView) findViewById(R.id.content);

        RequestOptions requestOptions = new RequestOptions()
                .placeholder(R.drawable.saler_load);
        Glide.with(getApplicationContext()).load(getString(R.string.saler_url)+image)
                .apply(requestOptions)
                .into(imageView);
        name_view.setText(name);
        price_view.setText("￥:"+price);
        sold_view.setText("月售:"+sold);
        content_view.setText(content);
        type_view.setText(type);
    }
}